From: Florian Müllner Date: Thu, 2 Sep 2021 15:15:36 +0000 (+0200) Subject: panel: Show warning indicator when unsafe-mode is on X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~574^2^2~35 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=3bee7c7f4b6bea0d5749889339c860265cba55fe;p=gnome-shell.git panel: Show warning indicator when unsafe-mode is on MetaContext added an unsafe-mode property, which we will use to restrict a number of privileged operations unless it is enabled. It is meant to only be enabled temporarily for development/debugging purposes, so add a scary icon to the top bar as a reminder to turn it off again. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/3943 Part-of: --- diff --git a/js/ui/panel.js b/js/ui/panel.js index 89b082ad0..dafba690a 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -507,6 +507,20 @@ class PanelCorner extends St.DrawingArea { } }); +const UnsafeModeIndicator = GObject.registerClass( +class UnsafeModeIndicator extends PanelMenu.SystemIndicator { + _init() { + super._init(); + + this._indicator = this._addIndicator(); + this._indicator.icon_name = 'channel-insecure-symbolic'; + + global.context.bind_property('unsafe-mode', + this._indicator, 'visible', + GObject.BindingFlags.SYNC_CREATE); + } +}); + var AggregateLayout = GObject.registerClass( class AggregateLayout extends Clutter.BoxLayout { _init(params = {}) { @@ -568,6 +582,7 @@ class AggregateMenu extends PanelMenu.Button { this._location = new imports.ui.status.location.Indicator(); this._nightLight = new imports.ui.status.nightLight.Indicator(); this._thunderbolt = new imports.ui.status.thunderbolt.Indicator(); + this._unsafeMode = new UnsafeModeIndicator(); this._indicators.add_child(this._remoteAccess); this._indicators.add_child(this._thunderbolt); @@ -579,6 +594,7 @@ class AggregateMenu extends PanelMenu.Button { this._indicators.add_child(this._bluetooth); this._indicators.add_child(this._rfkill); this._indicators.add_child(this._volume); + this._indicators.add_child(this._unsafeMode); this._indicators.add_child(this._power); this._indicators.add_child(this._powerProfiles);